//
//  MPVolumeView+Slider.swift
//  CoolTennisBall
//
//  Created by CA on 16/5/31.
//  Copyright © 2016年 CoolLang. All rights reserved.
//

import Foundation
import MediaPlayer

extension MPVolumeView {
    var volumeSlider:UISlider {
        self.showsRouteButton = false
        self.showsVolumeSlider = false
        self.isHidden = true
        var slider = UISlider()
        for subview in self.subviews {
            if subview.isKind(of: UISlider.self){
                slider = subview as! UISlider
                slider.isContinuous = false
                (subview as! UISlider).value = AVAudioSession.sharedInstance().outputVolume
                return slider
            }
        }
        return slider
    }
}
